import request from '@/utils/request'
import type { DispatchVehicleInfo } from '@/types/dispatch'

// 获取发车管理数据
export function getDispatchVehicles() {
  return request.get<{
    waitingDispatch: DispatchVehicleInfo[]
    dispatched: DispatchVehicleInfo[]
  }>('/api/tenant/dispatch/vehicles')
}

// 执行发车
export function dispatchVehicle(vehicleId: number) {
  return request.post<string>(`/api/tenant/dispatch/${vehicleId}`)
}

// 撤销发车
export function cancelDispatch(vehicleId: number) {
  return request.post<string>(`/api/tenant/dispatch/${vehicleId}/cancel`)
}
